import { request } from '@/request'
import { addEmployeeData, employeeItem, employeeParams, employeeResult } from '@/types/employee'

export function getEmployeeListApi(params: employeeParams) {
  return request<employeeResult>(
    '/admin/employee/page', "get", params
  )
}

export function updateStatusApi(id: number, status: number,) {
  return request(
    `/admin/employee/status/${status}`, "post", { id }, true
  )
}

export function addEmployeeApi(data: addEmployeeData) {
  return request(
    '/admin/employee', "post", data
  )
}

export function getEmployeeDetailApi(id: number) {
  return request<employeeItem>(
    `/admin/employee/${id}`, "get"
  )
}

export function updateEmployeeApi(data: addEmployeeData) {
  return request(
    '/admin/employee', "put", data
  )
}

export function deleteEmployeeApi(id: number) {
  return request(
    '/admin/employee/delete', "post", { id }
  )
}